/*
 * Copyright (C) 2021 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.tumblr.backboard.Utils;

import ohos.agp.components.Component;

/**
 * View
 *
 * @author stt
 * @since 2021-05-08
 */
public class View {
    /**
     * A Property wrapper around the <code>scaleX</code> functionality handled by the {
     * Component#setScaleX(float)} and {Component#getScaleX()} methods.
     */
    public static final Property<Component, Float> SCALE_X = new FloatProperty<Component>("scaleX") {
        @Override
        public void setValue(Component component, float value) {
            component.setScaleX(value);
        }

        @Override
        public Float get(Component component) {
            return component.getScaleX();
        }
    };
    /**
     * A Property wrapper around the <code>scaleY</code> functionality handled by the {
     * Component#setScaleY(float)} and {Component#getScaleY()} methods.
     */
    public static final Property<Component, Float> SCALE_Y = new FloatProperty<Component>("scaleY") {
        @Override
        public void setValue(Component component, float value) {
            component.setScaleY(value);
        }

        @Override
        public Float get(Component component) {
            return component.getScaleY();
        }
    };

    /**
     * A Property wrapper around the <code>translationX</code> functionality handled by the {
     * Component#setTranslationX(float)} and {Component#getTranslationX()} methods.
     */
    public static final Property<Component, Float> TRANSLATION_X = new FloatProperty<Component>("translationX") {
        @Override
        public void setValue(Component component, float value) {
            component.setTranslationX(value);
        }

        @Override
        public Float get(Component component) {
            return component.getTranslationX();
        }
    };

    /**
     * A Property wrapper around the <code>translationY</code> functionality handled by the {
     * Component#setTranslationY(float)} and {Component#getTranslationY()} methods.
     */
    public static final Property<Component, Float> TRANSLATION_Y = new FloatProperty<Component>("translationY") {
        @Override
        public void setValue(Component component, float value) {
            component.setTranslationY(value);
        }

        @Override
        public Float get(Component component) {
            return component.getTranslationY();
        }
    };

    private View() {
    }
}
